<?php

// This file is part of the Carrington Mobile Theme for WordPress
// http://carringtontheme.com
//
// Copyright (c) 2008-2009 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
// **********************************************************************

if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) { die(); }
if (CFCT_DEBUG) { cfct_banner(__FILE__); }

?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile10.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="<?php bloginfo('html_type') ?>; charset=<?php bloginfo('charset') ?>" />
	
	<title><?php wp_title('&laquo;', true, 'right'); bloginfo('name'); ?></title>
	
	<meta name="viewport" content="width=160; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>
	<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" charset="utf-8" />
	<style type="text/css">
		@import url(<?php echo trailingslashit(get_bloginfo('template_url')).'css/advanced.css'; ?>);
		@import url(<?php echo trailingslashit(get_bloginfo('wpurl')).'wp-content/plugins/openid/f/openid.css'; ?>);
	</style>
	<script type="text/javascript">
	<!--
<?php

is_page() ? $page = 'true' : $page = 'false';
echo '	CFMOBI_IS_PAGE = '.$page.';';
echo "	CFMOBI_PAGES_TAB = '".str_replace("'", "\'", __('Ứng dụng', 'carrington-mobile'))."';";
echo "	CFMOBI_POSTS_TAB = '".str_replace("'", "\'", __('Tin mới', 'carrington-mobile'))."';";
echo "	CFMOBI_HOTS_TAB = '".str_replace("'", "\'", __('Tin hot', 'carrington-mobile'))."';";

global $cfmobi_touch_browsers;
if (!isset($cfmobi_touch_browsers) || !is_array($cfmobi_touch_browsers)) {
	$cfmobi_touch_browsers = array(
		'iPhone',
		'iPod',
		'Android',
		'BlackBerry9530',
		'LG-TU915 Obigo', // LG touch browser
		'LGE VX',
		'webOS', // Palm Pre, etc.
	);
}
if (count($cfmobi_touch_browsers)) {
	$touch = array();
	foreach ($cfmobi_touch_browsers as $browser) {
		$touch[] = str_replace('"', '\"', trim($browser));
	}

?>
	var CFMOBI_TOUCH = ["<?php echo implode('","', $touch); ?>"];
	for (var i = 0; i < CFMOBI_TOUCH.length; i++) {
		if (navigator.userAgent.indexOf(CFMOBI_TOUCH[i]) != -1) {
			document.write('<?php echo str_replace('/', '\/', '<link rel="stylesheet" href="'.trailingslashit(get_bloginfo('template_url')).'css/touch.css" type="text/css" media="screen" charset="utf-8" />'); ?>');
			break;
		}
	}
<?php

}

?> 
	document.write('<?php

ob_start();
wp_print_scripts();
$wp_scripts = ob_get_contents();
ob_end_clean();

echo trim(str_replace(
	array("'", "\n", '/'), 
	array("\'", '', '\/'),
	$wp_scripts
));

?>');
	//--></script>


</head>
<body
<?php
$current_user = wp_get_current_user()->wp_capabilities;
$administrator = $current_user["administrator"];

?>
	<?php if(is_single() || is_page()) {echo '';} else { echo ' id="is-list"';} ?>>
<h1 id="site-name">
	<a class="home" rel="home" href="<?php bloginfo('url'); ?>"><?php bloginfo('name');?></a>
	<div class="tool-bar">
<?php if(!is_user_logged_in()):?>

		<form name="loginform" id="loginform-google" action="<?php  echo bloginfo("url"); ?>/wp-login.php" method="post">
			<input type="hidden" name="openid_identifier" id="openid_identifier" class="input openid_identifier" value="https://www.google.com/accounts/o8/id" size="20" tabindex="25">
			<input type="hidden" name="redirect_to" value="<?php  echo bloginfo("url"); ?>/?page_id=4">
			<input type="submit" name="wp-submit" id="wp-submit-google" class="button-primary" value="" tabindex="100">
		</form>
		<form name="loginform" id="loginform-yahoo" action="<?php  echo bloginfo("url"); ?>/wp-login.php" method="post">
			<input type="hidden" name="openid_identifier" id="openid_identifier" class="input openid_identifier" value="http://me.yahoo.com/" size="20" tabindex="25">
			<input type="hidden" name="redirect_to" value="<?php  echo bloginfo("url"); ?>/?page_id=4">
			<input type="submit" name="wp-submit" id="wp-submit-yahoo" class="button-primary" value="" tabindex="100">
		</form>
		<!--<a href="#"><img src="<?php echo bloginfo('template_url').'/img/yahoo.gif';?>" /></a>-->
		<form name="loginform" id="loginform" action="<?php  echo bloginfo("url"); ?>/wp-login.php" method="post">
			<input type="text" name="openid_identifier" id="openid_identifier" class="input openid_identifier" value="" size="15" tabindex="25">
			<input type="hidden" name="redirect_to" value="<?php  echo bloginfo("url"); ?>/?page_id=4">
			<input type="submit" name="wp-submit" id="wp-submit" class="button-primary" value="Đăng nhập" tabindex="100">
		</form>
	<?php else:?>
		<ul>
			<li><a href="<?php echo bloginfo('url'); ?>/?page_id=4">Trang cá nhân</a></li>
			<li><a>|</a></li>
			<li><a href="<?php echo wp_logout_url(WP_SITEURL); ?>">Thoát</a></li>
		</ul>
	<?php endif;?>
	</div>
</h1>
<hr />

<p id="navigation-top" class="navigation">
	<?php cfct_misc('main-nav'); ?>
</p>

<hr />

<?php
	
	$cat=get_query_var('cat');
if($cat){
	echo '<div><ul class="disclosure table group">';
$args=array(
  'orderby' => 'name',
  'order' => 'ASC',
   'child_of = 1'
  );

 $categories= get_categories($args); 
  foreach ($categories as $category) {
  	  if($category->parent == $cat){
  	  	 $url_image = cfct_get_category_image($category->cat_ID);
		$url_image=explode('@',$url_image[0]->url);
		$url_image=$url_image[0];
  	  	   $view.='<div class="cbox w80 fl">
  <a href="' . get_category_link( $category->term_id ) . '"><img alt="'.$category->name.'" src="'.$url_image.'" width="40px" height="31px"/><p>'.$category->name.'</p></a> </div>';
  	  	  
  	  }
  }

  echo $view;
  echo '<div style="clear:both"></div></ul>	</div>';

}/*else{
 $categories=  get_categories($args); 
  foreach ($categories as $category) {
  	  if($category->parent == 3){
$url_image = cfct_get_category_image($category->cat_ID);

		$url_image=explode('@',$url_image[0]->url);
		$url_image=$url_image[0];
  	  	   $view.='<div class="cbox w80 fl">
 			<a href="' . get_category_link( $category->term_id ) . '"><img alt="'.$category->name.'" src="'.$url_image.'" width="40px" height="31px"/><p>'.$category->name.'</p></a> </div>';
  	  	  
  	  }
  }
  echo $view;
}*/
	?>
	
	
	
